﻿@model Zavand.Web.Mvc.Manana.SampleWebsite.Areas.Area1.Controllers.Default.Actions.Index.Model

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Index</h2>
|
@(Html.ActionLinkClone(String.Format("[5]"), Model.GetRoute(), m => { m.PageSize = 5; m.Page = 1;}))
@(Html.ActionLinkClone(String.Format("[10]"), Model.GetRoute(), m => { m.PageSize = 10; m.Page = 1; }))
@(Html.ActionLinkClone(String.Format("[15]"), Model.GetRoute(), m => { m.PageSize = 15; m.Page = 1; }))
@(Html.ActionLinkClone(String.Format("[20]"), Model.GetRoute(), m => { m.PageSize = 20; m.Page = 1; }))
|

<table>
@foreach (var u in Model.Users)
{
    <tr>
    <td>@u.ID</td>
    <td>@u.FirstName</td>
    <td>@u.LastName</td>
    <td align="right">@u.Birthday.Value.ToShortDateString()</td>
    </tr>
}
</table>

<div>
@if (Model.Page > 1)
{
    @(Html.ActionLinkClone(String.Format("|<< "), Model.GetRoute(), m => { m.Page = Model.GetRoute().Page - 1; }))
}
else
{
    <text>|<< </text>
}
@if (Model.Page < Model.TotalPages)
{
    @(Html.ActionLinkClone(String.Format(" >>|"), Model.GetRoute(), m => { m.Page = Model.GetRoute().Page + 1; }))
}
else
{
    <text> >>|</text>
}
&nbsp;
@for (int i = 1; i <= Model.TotalPages; i++){<text>@(Html.ActionLinkClone(String.Format("[{0}]",i), Model.GetRoute(), m => { m.Page = i; }))</text>}
</div>
